﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CoolERP_BLL;
using CoolERP_Entities;
using CoolERP_Common;

namespace CoolERP_Web.User
{
    public partial class Print_WLTM : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindFirst();
                BindData();
            }
        }

        private void BindFirst()
        {
            BindWLLX(this.ddlWLLX, "请选择");
            BindGYS(this.ddlGYSID, "请选择");
        }

        private void BindData()
        {
            Dictionary<string, string> dc = new Dictionary<string, string>();
            dc.Add("WPLX", EnumHelper.GetDescriptionByName(typeof(EnumKC_LX), EnumKC_LX.WL));
            if (!string.IsNullOrEmpty(tbBH.Text))
                dc.Add("BH", tbBH.Text.Trim());
            if (!string.IsNullOrEmpty(tbMC.Text))
                dc.Add("MC", tbMC.Text.Trim());
            if (!string.IsNullOrEmpty(ddlWLLX.SelectedValue))
                dc.Add("WLLX", ddlWLLX.SelectedValue);
            if (!string.IsNullOrEmpty(ddlGYSID.SelectedValue))
                dc.Add("GYS", ddlGYSID.SelectedValue);
            using (KCBLL kBLL = new KCBLL())
            {
                int RecordCount = 0;
                List<WLKCModel> itemLists = kBLL.GetWLKC(dc, true, "BH asc", null, 1000, out RecordCount);
                Repeater1.DataSource = itemLists;
                Repeater1.DataBind();
            }
        }

        protected void btnQuery_Click(object sender, EventArgs e)
        {
            BindData();
        }
    }
}